package com.charlygao.entity;

public class TurnRule 
{
	private int turnGroup [] = new int[100];
	public int condGate = 0;
	public double hpGate = 0.5;
	public int lvGate = 150;
	public int turnNum = 0;
	
	public TurnRule()
	{
		clearShip();
	}
	
	public void addShip(int shipId)
	{
		turnGroup[turnNum++] = shipId;
	}
	
	public void setShip(int pos, int shipId)
	{
		turnGroup[pos] = shipId;
	}
	
	public void clearShip()
	{
		turnNum = 0;
		for (int i = 0; i < 100; i++)
			turnGroup[i] = 0;
	}
	
	public int getShip(int pos)
	{
		return turnGroup[pos];
	}
	
	public void shipSet(String nameList)
	{
		String [] list = nameList.split(",");
		for (String name : list)
			addShip(NameMap.get(name.trim()));
	}
	
	public boolean inTurn(int shipId)
	{
		for (int id : turnGroup)
			if (shipId == id)
				return true;
		return false;
	}
}
